Skip to content

feat(codecov): bundle analyzer#7829

Closed
avivkeller wants to merge 8 commits into
mainfrom
feat/codecov-bundle-analysis
Closed

feat(codecov): bundle analyzer#7829
avivkeller wants to merge 8 commits into
mainfrom
feat/codecov-bundle-analysis

Conversation

@avivkeller

@avivkeller avivkeller commented Jun 2, 2025

Copy link
Copy Markdown
Member

Adds codecov bundle analysis to our CI

Copilot AI review requested due to automatic review settings June 2, 2025 15:48
@avivkeller avivkeller requested review from a team as code owners June 2, 2025 15:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request integrates the Codecov bundle analyzer into our CI pipeline.

  • Added the "@codecov/nextjs-webpack-plugin" dev dependency.
  • Updated the Next.js configuration to enable the Codecov plugin when the ANALYZE environment variable is set.
  • Modified the CI workflow to conditionally set the ANALYZE flag for supported OS and event types.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
apps/site/package.json Added Codecov bundle analyzer plugin as a dev dependency.
apps/site/next.config.mjs Integrated the Codecov plugin into the webpack configuration.
.github/workflows/build.yml Updated the build workflow to set the ANALYZE environment variable.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread apps/site/next.config.mjs
@vercel

vercel Bot commented Jun 2, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jun 2, 2025 4:47pm

@codecov

codecov Bot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.44%. Comparing base (c11af00) to head (8d8b4d0).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7829      +/-   ##
==========================================
- Coverage   75.48%   75.44%   -0.04%     
==========================================
  Files         101      101              
  Lines        8309     8309              
  Branches      218      218              
==========================================
- Hits         6272     6269       -3     
- Misses       2035     2038       +3     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MattIPv4

MattIPv4 commented Jun 2, 2025

Copy link
Copy Markdown
Member

Hm, isn't this going to prevent us migrating to turbopack?

@avivkeller

Copy link
Copy Markdown
Member Author

Hm, isn't this going to prevent us migrating to turbopack?

How so?

@MattIPv4

MattIPv4 commented Jun 2, 2025

Copy link
Copy Markdown
Member

How so?

This is going to force Next.js to use Webpack, presumably?

@avivkeller

Copy link
Copy Markdown
Member Author

This is going to force Next.js to use Webpack, presumably?

It doesn't force Next.js to use Webpack. If it's built with turbo, the webpack key is ignored. See https://nextjs.org/docs/app/api-reference/turbopack#unsupported-and-unplanned-features

@MattIPv4

MattIPv4 commented Jun 2, 2025

Copy link
Copy Markdown
Member

Ah okay, so we'll just lose bundle reporting if we do migrate, but it doesn't outright block it 👍

@avivkeller avivkeller marked this pull request as draft June 2, 2025 16:06
@avivkeller

Copy link
Copy Markdown
Member Author

Drafting while I verify this works, and see if there is a way to do bundle analysis through Codecov for both Turbopack and Webpack.

@avivkeller avivkeller marked this pull request as ready for review June 2, 2025 16:17
@avivkeller

Copy link
Copy Markdown
Member Author

Comment thread apps/site/next.config.mjs Outdated
Comment thread apps/site/next.config.mjs
'shiki',
],
},
webpack: (config, options) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work even with TurboPack enabled? We are by default building on CI with TurboPack... So I imagine this wouldn't work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp, apparently you passing the webpack config flag is disabling turbopack :/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was removed as part of the Cloudflare adapter PR

@avivkeller avivkeller Jun 2, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that should be re enabled? I'll adjust this PR accordingly if that flag is added back

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread apps/site/package.json
@avivkeller avivkeller marked this pull request as draft June 2, 2025 18:12
@avivkeller

Copy link
Copy Markdown
Member Author

Drafting while I adjust for turbo pack, plus this shouldn’t land until the flag is re added.

@avivkeller

Copy link
Copy Markdown
Member Author

There doesn't appear to be an elegant solution to this. We could write our own reporter, but that's more unrealted code we need to maintain.

I'm closing this to give someone else the opportunity to find a solution. We need a reporter that supports both Turbopack and the App Router.

@avivkeller avivkeller closed this Jun 2, 2025
@avivkeller avivkeller deleted the feat/codecov-bundle-analysis branch June 2, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants